//
//  WayPointHeaderView.m
//  Travel_M_Travel
//
//  Created by APPLE10 on 15-4-1.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "WayPointHeaderView.h"
#import "UIColor+AddColor.h"
@implementation WayPointHeaderView

-(void)dealloc
{
    [_wpHeaderLable release];
    [_dayLable release];
    [_wayData release];
    [_headerImagev release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if ( self) {
        self.backgroundColor =[UIColor colorFromHexCode:@"#B2DFEE"];
        
        self.wpHeaderLable = [[UILabel alloc]init];
        //        _wpHeaderLable.backgroundColor = [UIColor yellowColor];
        _wpHeaderLable.font = [UIFont fontWithName:@"Georgia" size:13];
        
        [self addSubview:_wpHeaderLable];
        
        self.dayLable = [[UILabel alloc]init];
        
        _dayLable.font = [UIFont fontWithName:@"Georgia" size:13];
        
        //        _dayLable.backgroundColor = [UIColor redColor];
        [self addSubview:_dayLable];
        
        self.headerImagev = [[UIImageView alloc]init];
        _headerImagev.contentMode = UIViewContentModeScaleAspectFit;
        _headerImagev.image = [UIImage imageNamed:@"quan.png"];
        [self addSubview:_headerImagev];
        
        [_headerImagev release];
        [_dayLable release];
        [_wpHeaderLable release];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.headerImagev.frame = CGRectMake(0, 0, self.frame.size.width * 2/10 , self.frame.size.height);
    self.wpHeaderLable.frame = CGRectMake(self.frame.size.width * 2/10,  0 , self.frame.size.width * 3/10 , self.frame.size.height);
    self.dayLable.frame = CGRectMake(self.frame.size.width * 5 / 10, 0, self.frame.size.width *3/10 , self.frame.size.height);
}
- (void)setWayData:(WayPointDataSource *)wayData
{
    if (self.wayData != wayData) {
        [_wayData release];
        _wayData = [wayData retain];
    }
    self.wpHeaderLable.text = wayData.date;
    NSString *str = [NSString stringWithFormat:@"%@",wayData.day];
    NSString *str1 = @"第";
    NSString *str2 = @"天";
    str = [[str1 stringByAppendingString:str] stringByAppendingString:str2];
    self.dayLable.text = str;
}
@end
